package com.hkbigdata.sybx.mapper;

import java.util.List;

/**
 * @author yangjing
 * @creat 2025-05-14-21:48
 * @email 3010335359@qq.com
 */

import com.hkbigdata.sybx.bean.UserQuestionnaire;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserQuestionnaireMapper {
    // 查看所有用户信息
    @Select("select questionnaire_id, goal_purpose, functions, frequency, satisfaction_degree, suggestion, created_at, user_id from user_questionnaire")
    List<UserQuestionnaire> getAllUsers();

    // 插入记录
    @Options(useGeneratedKeys = false)
    @Insert("INSERT INTO user_questionnaire (goal_purpose, functions, frequency, satisfaction_degree, suggestion, user_id) " +
            "VALUES (#{goal_purpose}, #{functions}, #{frequency}, #{satisfaction_degree}, #{suggestion}, #{user_id})")
    int addQuestionnaire(UserQuestionnaire userQuestionnaire);

    // 根据用户ID删除记录
    @Delete("DELETE FROM user_questionnaire WHERE user_id = #{userId}")
    int deleteByUserId(@Param("userId") String userId);
}